home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Franz PD
/
Franz PD Disk #113 (1991-01)(Amiga User Group Deutschland e.V.).zip
/
Franz PD Disk #113 (1991-01)(Amiga User Group Deutschland e.V.).adf
/
Rätsel
/
Linien
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1989-07-03
|
8KB
|
348 lines
acbmname$="PUNKTE"
REM IF FRE(1)<30000& THEN CLEAR,,30000&
DIM bPlane&(5), cTabWork%(32), cTabSave%(32)
DECLARE FUNCTION xOpen& LIBRARY
DECLARE FUNCTION xRead& LIBRARY
DECLARE FUNCTION xWrite& LIBRARY
DECLARE FUNCTION AllocMem&() LIBRARY
LIBRARY "dos.library"
LIBRARY "exec.library"
LIBRARY "graphics.library"
loadError$ = ""
GOSUB LoadACBM
IF loadError$ <> "" THEN GOTO Mcleanup
IF foundCCRT AND ccrtDir% THEN
FOR kk = 0 TO nColors% -1
cTabSave%(kk) = PEEKW(colorTab&+(kk*2))
cTabWork%(kk) = cTabSave%(kk)
NEXT
FOR kk = 0 TO 80
IF ccrtDir% = 1 THEN
GOSUB Fcycle
ELSE
GOSUB Bcycle
END IF
CALL LoadRGB4&(sViewPort&,VARPTR(cTabWork%(0)),nColors%)
FOR de1 = 0 TO ccrtSecs& * 3000
FOR de2 = 0 TO ccrtMics& / 500
NEXT
NEXT
NEXT
CALL LoadRGB4&(sViewPort&,VARPTR(cTabSave%(0)),nColors%)
END IF
Mcleanup:
GOTO anfang
Mcleanup2:
REM LIBRARY CLOSE
IF loadError$ <> "" THEN PRINT loadError$
END
cTemp% = cTabWork%(ccrtEnd%)
FOR jj = ccrtEnd%-1 TO ccrtStart% STEP -1
cTabWork%(jj+1) = cTabWork%(jj)
NEXT
cTabWork%(ccrtStart%) = cTemp%
RETURN
Fcycle: '" Farbzyklus vorwärts (forward)
cTemp% = cTabWork%(ccrtStart%)
FOR jj = ccrtStart%+1 TO ccrtEnd%
cTabWork%(jj-1) = cTabWork%(jj)
NEXT
cTabWork%(ccrtEnd%) = cTemp%
RETURN
LoadACBM:
'" - Folgende Variablen müssen
'" - initialisiert sein:
REM - ACBMname$ (ACBM-Dateiname)
REM - Variablen initialisieren
f$ = acbmname$
fHandle& = 0
mybuf& = 0
foundBMHD = 0
foundCMAP = 0
foundCAMG = 0
foundCCRT = 0
foundABIT = 0
REM - aus include/libraries/dos.h
REM - MODE_NEWFILE = 1006
REM - MODE_OLDFILE = 1005
filename$ = f$ + CHR$(0)
fHandle& = xOpen&(SADD(filename$),1005)
IF fHandle& = 0 THEN
loadError$ = "Eingabedatei nicht gefunden/lesbar."
GOTO Lcleanup
END IF
REM - Pufferspeicherplatz reservieren
ClearPublic& = 65537
mybufsize& = 360
mybuf& = AllocMem&(mybufsize&,ClearPublic&)
IF mybuf& = 0 THEN
loadError$ = "Pufferspeicherplatz nicht verfügbar."
GOTO Lcleanup
END IF
inbuf& = mybuf&
cbuf& = mybuf& + 120
ctab& = mybuf& + 240
REM - Eingabe sollte lauten FORMnnnnACBM
rLen& = xRead&(fHandle&,inbuf&,12)
tt$ = ""
FOR kk = 8 TO 11
tt% = PEEK(inbuf& + kk)
tt$ = tt$ + CHR$(tt%)
NEXT
IF tt$ <> "ACBM" THEN
loadError$ = "Keine ACBM-Grafikdatei."
GOTO Lcleanup
END IF
REM - ACBM-Datei Chunk-weise lesen
ChunkLoop:
REM - Chunk-Name/Länge ermitteln
rLen& = xRead&(fHandle&,inbuf&,8)
icLen& = PEEKL(inbuf& + 4)
tt$ = ""
FOR kk = 0 TO 3
tt% = PEEK(inbuf& + kk)
tt$ = tt$ + CHR$(tt%)
NEXT
IF tt$ = "BMHD" THEN 'BitMap-Header
foundBMHD = 1
rLen& = xRead&(fHandle&,inbuf&,icLen&)
iWidth% = PEEKW(inbuf&)
iHeight% = PEEKW(inbuf& + 2)
iDepth% = PEEK(inbuf& + 8)
iCompr% = PEEK(inbuf& + 10)
scrWidth% = PEEKW(inbuf& + 16)
scrHeight% = PEEKW(inbuf& + 18)
iRowBytes% = iWidth% /8
scrRowBytes% = scrWidth% / 8
nColors% = 2^(iDepth%)
'" - Genug Platz für Videospeicher ?
AvailRam& = FRE(-1)
NeededRam& = ((scrWidth%/8)*scrHeight%*(iDepth%+1))+5000
IF AvailRam& < NeededRam& THEN
loadError$ = "Speicherplatz reicht nicht aus."
GOTO Lcleanup
END IF
kk = 1
IF scrWidth% > 320 THEN kk = kk + 1
IF scrHeight% > 200 THEN kk = kk + 2
SCREEN 2,scrWidth%,scrHeight%,5,1
WINDOW 2,"",,0,2
CALL freesprite (0)
REM - Adressen von Screen-Structures ermitteln
GOSUB GetScrAddrs
REM - Schirm während Ladevorgang dunkel
CALL LoadRGB4&(sViewPort&,ctab&,nColors%)
ELSEIF tt$ = "CMAP" THEN 'Farbpalette
foundCMAP = 1
rLen& = xRead&(fHandle&,cbuf&,icLen&)
REM - Farbpalette aufbauen
FOR kk = 0 TO nColors% - 1
red% = PEEK(cbuf&+(kk*3))
gre% = PEEK(cbuf&+(kk*3)+1)
blu% = PEEK(cbuf&+(kk*3)+2)
regTemp% = (red%*16)+(gre%)+(blu%/16)
POKEW(ctab&+(2*kk)),regTemp%
NEXT
ELSEIF tt$ = "CAMG" THEN 'Amiga ViewPort Modes
foundCAMG = 1
rLen& = xRead&(fHandle&,inbuf&,icLen&)
camgModes& = PEEKL(inbuf&)
ELSEIF tt$ = "CCRT" THEN 'Graphicraft-Farbzyklus-Daten
foundCCRT = 1
rLen& = xRead&(fHandle&,inbuf&,icLen&)
ccrtDir% = PEEKW(inbuf&)
ccrtStart% = PEEK(inbuf& + 2)
ccrtEnd% = PEEK(inbuf& + 3)
ccrtSecs& = PEEKL(inbuf& + 4)
ccrtMics& = PEEKL(inbuf& + 8)
ELSEIF tt$ = "ABIT" THEN 'Contiguous BitMap
foundABIT = 1
'" - Hier werden nur volle BitMaps verarbeitet, keine
'" - Ausschnitte wie z.B. Pinsel (Brushes).
'" - Sehr schnell, liest ganze BitPlanes.
plSize& = (scrWidth%/8) * scrHeight%
FOR pp = 0 TO iDepth% -1
rLen& = xRead&(fHandle&,bPlane&(pp),plSize&)
NEXT
ELSE
REM - unbekannten Chunk-Typ lesen
FOR kk = 1 TO icLen&
rLen& = xRead&(fHandle&,inbuf&,1)
NEXT
'" - Wenn Länge ungerade, noch 1 Byte lesen
IF (icLen& OR 1) = icLen& THEN
rLen& = xRead&(fHandle&,inbuf&,1)
END IF
END IF
REM - Fertig, wenn alle Chunks gelesen
IF foundBMHD AND foundCMAP AND foundABIT THEN
GOTO GoodLoad
END IF
REM - Lesen ok, nächsten Chunk lesen
IF rLen& > 0 THEN GOTO ChunkLoop
IF rLen& < 0 THEN ' Lesefehler
loadError$ = "Lesefehler."
GOTO Lcleanup
END IF
REM - rLen& = 0 heißt EOF (Dateiende)
IF (foundBMHD=0) OR (foundABIT=0) OR (foundCMAP=0) THEN
loadError$ = "Wichtige IFF-Chunks nicht gefunden."
GOTO Lcleanup
END IF
GoodLoad:
loadError$ =""
REM Farbpalette
IF foundCMAP THEN
CALL LoadRGB4&(sViewPort&,ctab&,nColors%)
END IF
Lcleanup:
IF fHandle& <> 0 THEN CALL xClose&(fHandle&)
IF mybuf& <> 0 THEN CALL FreeMem&(mybuf&,mybufsize&)
RETURN
GetScrAddrs:
REM - Adressen von Screen-Structures ermitteln
sWindow& = WINDOW(7)
sScreen& = PEEKL(sWindow& + 46)
sViewPort& = sScreen& + 44
sRastPort& = sScreen& + 84
sColorMap& = PEEKL(sViewPort& + 4)
colorTab& = PEEKL(sColorMap& + 4)
sBitMap& = PEEKL(sRastPort& + 4)
REM - Screen-Parameter ermitteln
scrWidth% = PEEKW(sScreen& + 12)
scrHeight% = PEEKW(sScreen& + 14)
scrDepth% = PEEK(sBitMap& + 5)
nColors% = 2^scrDepth%
REM - Adressen der BitPlanes ermitteln
FOR kk = 0 TO scrDepth% - 1
bPlane&(kk) = PEEKL(sBitMap&+8+(kk*4))
NEXT
RETURN
anfang:
']]]]]]]]]]]]]]]]]]]]]]]]]]]]
b=0
LINE (30,190)-(100,215),4,bf
LINE (29,189)-(101,216),2,b
COLOR 7,4:LOCATE 26,5:PRINT "ZEICHNEN"
maus:
WHILE 1
v= MOUSE(0)
IF MOUSE(0) = 0 THEN WEND
CALL maus(x,y)
IF x>30 AND x<100 AND y>180 AND y<210 THEN GOTO zeichnen
IF x>250 AND x<305 AND y>30 AND y<50 THEN GOTO ende
SUB maus (x,y) STATIC
x = MOUSE(1)
y = MOUSE(2)
END SUB
GOTO maus
zeichnen:
WINDOW 2
a=MOUSE(0):x=MOUSE(1):y=MOUSE(2)
WHILE MOUSE(0)<>0
LINE(x,y)-(MOUSE(1),MOUSE(2)),b
IF x>30 AND x<100 AND y>180 AND y<210 THEN GOTO zeichnen
IF x>250 AND x<305 AND y>30 AND y<50 THEN GOTO ende
IF x>30 AND x<100 AND y>30 AND y<50 THEN GOTO aufloesung
IF x>240 AND x<310 AND y>180 AND y<210 THEN GOTO neu
x=MOUSE(1):y=MOUSE(2)
WEND
GOTO zeichnen
END
aufloesung:
a=0:
LINE (90,73)-(165,116),a
LINE (90,109)-(165,152),a
LINE (90,139)-(165,185),a
LINE (165,152)-(247,111),a
LINE (165,185)-(247,141),a
LINE (165,116)-(247,76),a
LINE (165,116)-(165,217),a
LINE (116,86)-(198,47),a
LINE (140,101)-(220,60),a
GOTO anfang
neu:
COLOR 2,6
AREA (91,73):AREA (91,166):AREA (165,217):AREAFILL
AREA (91,73):AREA (165,217):AREA (247,76):AREAFILL
AREA (165,217):AREA (247,76):AREA (247,171):AREAFILL
AREA (91,73):AREA (247,76):AREA (175,33):AREAFILL
CIRCLE (190,62),6,5,,,1:PAINT (190,62),5
CIRCLE (170,100),6,5,,,1:PAINT (170,100),5
CIRCLE (118,72),6,5,,,1:PAINT (118,72),5
CIRCLE (150,125),6,5,,,1:PAINT (150,125),5
CIRCLE (149,189),6,5,,,1:PAINT (149,189),5
CIRCLE (101,131),6,5,,,1:PAINT (101,131),5
CIRCLE (230,164),6,5,,,1:PAINT (230,164),5
CIRCLE (230,100),6,5,,,1:PAINT (230,100),5
CIRCLE (181,160),6,5,,,1:PAINT (181,160),5
GOTO anfang
END
ende:
WINDOW CLOSE 1
SCREEN CLOSE 1
SYSTEM
END
'**********************************************************************
' Detlef Kornatz
' Feuerbachstraße 6
' D-4300 ESSEN 1
'***********************************************************************